<include file="__THEME__/header" />
<link href="../Public/index.css" rel="stylesheet" type="text/css" />

<link href="__PUBLIC__/js/tbox/box.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="__PUBLIC__/js/jquery.js"></script>
<script type="text/javascript" src="__PUBLIC__/js/common.js"></script>
<script type="text/javascript" src="__PUBLIC__/js/tbox/box.js"></script>

<div class="content"><!-- 内容 begin  --> 
  <include file="__THEME__/apps" />
  <div class="main">
    <div class="mainbox">
      <div class="mainbox_C no_r">
      <div class="tab-menu">
        <div class="right"><a href="javascript:void(0)" onclick="postMessage();">发私信</a></div>
        <ul>
          <li><a class="feed_item <eq name="type" value="inbox">on</eq>"  href="{:U('home/Message/inbox')}" ><span>收件箱</span></a></li>
          <li><a class="feed_item <eq name="type" value="outbox">on</eq>" href="{:U('home/Message/outbox')}"><span>发件箱</span></a></li>
        </ul>
      </div>

      <div class=""> 
        <ul class="feed_list">
        <li class="t alR">
            <eq name="type" value="inbox">
            <a href="{:U('home/Message/inbox')}"><< 返回收件箱</a>
            <else/>
            <a href="{:U('home/Message/outbox')}"><< 返回发件箱</a>
            </eq>
        </li>
        
        <!-- 会话列表 -->
        <volist name="message" id="vo">
        <li class="lineD_btm <php>if($type=='inbox' && $vo['to_uid']==$ts['user']['uid'] && $vo['is_read']==0){</php>bg_warning<php>}</php>">
            <div class="userPic"><a href="{:U('home/Space/index', array('uid'=>$vo['from_uid']))}"><img card="1" src="{$vo.from_uid|getUserFace}"></a></div>
            <div class="left" style="width:110px;padding-left:10px">
                <a href="{:U('home/Space/index', array('uid'=>$vo['from_uid']))}">{$vo.from_uid|getUserName}</a><br />
                <span>{$vo.ctime|date="Y-m-d H:i:s",###}</span>
            </div>
            <div class="feed_c" style="margin-left:205px">
                <div class="msgCnt" style="padding-bottom:0;">
                    <div class="lineS_btm"><a href="javascript:void(0);">{$vo.title}</a></div>
                    <div style="padding-bottom:50px;">{$vo.content}</div>
                </div>
            </div>
         </li>
         </volist>
         
         <!-- 快速回复 -->
         <li id="message_reply">
             <div class="userPic"><a href="{:U('home/Space/index', array('uid'=>$ts['user']['uid']))}"><img card="1" src="{$ts['user']['uid']|getUserFace}"></a></div>
             <div class="left" style="width:110px;padding-left:10px">
                 <a href="{:U('home/Space/index', array('uid'=>$ts['user']['uid']))}" title="">{$ts['user']['uname']}</a>
             </div>
             <div class="feed_c" style="margin-left:205px">
             <div class="msgCnt" style="padding-bottom:0;">
                 <div style="padding-bottom:50px;"><strong>回复:</strong><br /><textarea id="reply_content" style="width: 99%;" rows="5" cols="" onblur="this.className='text'" onfocus="this.className='text2'" class="text"></textarea><br />
                 <input type="button" value="发送" class="btn_b mt5" onclick="doReply();"/></div>
             </div>
             </div>
         </li>
        </ul>
      </div>
      <div class="c"></div>
    </div>
  </div>
  <div class="clear"></div>
</div>
</div>
<!-- 内容 end --> 

<script type='text/javascript'>
    function doReply() {
        var reply_content = $('#reply_content').val();
        var message_id    = "{$message[0]['source_message_id']}";
        $.post("{:U('home/Message/doReply')}", {message_id:message_id, reply_content:reply_content}, function(res){
            if(res == '1') {
                $('#reply_content').val('');
                ui.success('发送成功');
                //window.location.reload();
            }else {
                ui.error('发送失败');
            }
        });
    }
    
    function postMessage() {
        ui.box.load("{:U('home/Message/post')}", {title:'发私信'});
    }
</script> 
<include file="__THEME__/footer" /> 